import {BasicColumn} from '/@/components/Table';
import {FormSchema} from '/@/components/Table';
import { rules} from '/@/utils/helper/validator';
import { render } from '/@/utils/common/renderUtils';
import {UploadTypeEnum} from "@/components/Form/src/jeecg/components/JUpload";
//列表数据
export const columns: BasicColumn[] = [
/*   {
    title: '学校编码',
    align:"center",
    dataIndex: 'xxbm',
   },
   {
    title: '人员pin值',//定义。建议和学号studentNo保持一致',
    align:"center",
    dataIndex: 'pin'
   },*/
  {
    title: '年级',
    align:"center",
    dataIndex: 'departmentId_dictText'
  },
   {
    title: '名称',
    align:"center",
    dataIndex: 'name'
   },
   {
    title: '性别',//0-未知1-男 2-女',
    align:"center",
    dataIndex: 'sex',
    customRender:({value,record})=>{
      return value==0?"未知":value==1?"男":"女";
     }
   },
   {
    title: '照片',
    align:"center",
    dataIndex: 'photo',
     slots: { customRender: 'img' },
   },
/*   {
    title: '是否检测照片质量 0-不检测，1-检测；默认0',
    align:"center",
    dataIndex: 'isDetectPhoto'
   },*/
   {
    title: '学号',
    align:"center",
    dataIndex: 'studentNo'
   },
   {
    title: '状态',//0-禁用，1-正常；默认1',
    align:"center",
    dataIndex: 'status',
     customRender:({value,record})=>{
       return value==0?"禁用":value==1?"正常":"";
     }
   },
   /*{
    title: '班级/部门id',
    align:"center",
    dataIndex: 'departmentId'
   },
   {
    title: '学校组织ID',
    align:"center",
    dataIndex: 'organizationId'
   },
   {
    title: 'usid',
    align:"center",
    dataIndex: 'usid'
   },
   {
    title: '天波学生id',
    align:"center",
    dataIndex: 'studentId'
   },*/
];
//查询数据
export const searchFormSchema: FormSchema[] = [
  {
    label: '名称',
    field: 'name',
    component: 'JInput',
  },
];
//表单数据
export const formSchema: FormSchema[] = [
/*  {
    label: '学校编码',
    field: 'xxbm',
    component: 'Input',
    dynamicRules: ({model,schema}) => {
          return [
                 { required: true, message: '请输入学校编码!'},
          ];
     },
  },*/

/*  {
    label: '人员pin值',//定义。建议和学号studentNo保持一致',
    field: 'pin',
    component: 'Input',
    dynamicRules: ({model,schema}) => {
          return [
                 { required: true, message: '请输入人员pin值定义。建议和学号studentNo保持一致!'},
          ];
     },
  },*/
  {
    label: '年级',
    field: 'departmentId',
    component: 'JSearchSelect',
    dynamicDisabled:true,
    componentProps:{
      dict:"ss_tpai_org,org_name,org_id"
    }
    /*    dynamicRules: ({model,schema}) => {
          return [
            { required: true, message: '请输入班级/部门id!'},
          ];
        },*/
  },
  {
    label: '名称',
    field: 'name',
    component: 'Input',
    dynamicRules: ({model,schema}) => {
          return [
                 { required: true, message: '请输入name!'},
          ];
     },
    dynamicDisabled:true,
  },
  {
    label: '性别',//0-未知1-男 2-女',
    field: 'sex',
    component: 'JDictSelectTag',
    componentProps:{
      dictCode:"sex",
      stringToNumber:true,
    },
    dynamicDisabled:true,
  },

  {
    label: '是否检测照片质量',// 0-不检测，1-检测；默认0',
    field: 'isDetectPhoto',
    component: 'Select',
    componentProps:{
      options:[{label:"不检测",value:0},{label:"检测",value:1}]
    },
    dynamicDisabled:true,
  },
  {
    label: '学号',
    field: 'studentNo',
    component: 'Input',
    dynamicDisabled:true,
  },
  {
    label: '状态',//0-禁用，1-正常；默认1',
    field: 'status',
    component: 'Select',
    dynamicRules: ({model,schema}) => {
          return [
                 { required: true, message: '请输入0-禁用，1-正常；默认1!'},
          ];
     },
    componentProps:{
      options:[{label:"禁用",value:0},{label:"正常",value:1}]
    },
    dynamicDisabled:true,
  },
  {
    label: '照片',
    field: 'photo',
    component: 'JUpload',
    helpMessage: '最多上传1张图片',
    componentProps: {
      fileType: UploadTypeEnum.image,
      maxCount: 1,
    },
  },

  {
    label: '学校组织ID',
    field: 'organizationId',
    component: 'InputNumber',
    dynamicRules: ({model,schema}) => {
          return [
                 { required: true, message: '请输入学校组织ID!'},
          ];
     },
    show: false
  },

  {
    label: 'usid',
    field: 'usid',
    component: 'JSearchSelect',
    componentProps:{
      dict:"ss_person,name,id",
    },
    dynamicDisabled:true,
    show: false
  },
  {
    label: '天波学生id',
    field: 'studentId',
    component: 'InputNumber',
    show: false
  },
  {
    label: 'id',
    field: 'id',
    component: 'Input',
    show: false
  },
];

// 高级查询数据
export const superQuerySchema = {
  xxbm: {title: 'xxbm',order: 0,view: 'text', type: 'string',},
  pin: {title: '人员pin值定义。建议和学号studentNo保持一致',order: 1,view: 'text', type: 'string',},
  name: {title: 'name',order: 2,view: 'text', type: 'string',},
  sex: {title: '0-未知1-男 2-女',order: 3,view: 'number', type: 'number',},
  photo: {title: 'photo',order: 4,view: 'text', type: 'string',},
  isDetectPhoto: {title: '是否检测照片质量 0-不检测，1-检测；默认0',order: 5,view: 'number', type: 'number',},
  studentNo: {title: '学号',order: 6,view: 'text', type: 'string',},
  status: {title: '0-禁用，1-正常；默认1',order: 7,view: 'number', type: 'number',},
  departmentId: {title: '班级/部门id',order: 8,view: 'number', type: 'number',},
  organizationId: {title: '学校组织ID',order: 9,view: 'number', type: 'number',},
  usid: {title: 'usid',order: 10,view: 'number', type: 'number',},
  studentId: {title: '天波学生id',order: 11,view: 'number', type: 'number',},
};

/**
* 流程表单调用这个方法获取formSchema
* @param param
*/
export function getBpmFormSchema(_formData): FormSchema[]{
  // 默认和原始表单保持一致 如果流程中配置了权限数据，这里需要单独处理formSchema
  return formSchema;
}
